import 'package:json_annotation/json_annotation.dart';

part 'person_info.g.dart';

@JsonSerializable()
class PersonInfo {
  final CoinInfo? coinInfo;
  final CollectArticleInfo? collectArticleInfo;
  final UserInfo? userInfo;

  const PersonInfo({
    this.coinInfo,
    this.collectArticleInfo,
    this.userInfo,
  });

  factory PersonInfo.fromJson(Map<String, dynamic> json) =>
      _$PersonInfoFromJson(json);

  Map<String, dynamic> toJson() => _$PersonInfoToJson(this);
}

@JsonSerializable()
class CoinInfo {
  final int? coinCount;
  final int? level;
  final String? nickname;
  final String? rank;
  final int? userId;
  final String? username;

  const CoinInfo({
    this.coinCount,
    this.level,
    this.nickname,
    this.rank,
    this.userId,
    this.username,
  });

  factory CoinInfo.fromJson(Map<String, dynamic> json) =>
      _$CoinInfoFromJson(json);

  Map<String, dynamic> toJson() => _$CoinInfoToJson(this);
}

@JsonSerializable()
class CollectArticleInfo {
  final int? count;

  const CollectArticleInfo({
    this.count,
  });

  factory CollectArticleInfo.fromJson(Map<String, dynamic> json) =>
      _$CollectArticleInfoFromJson(json);

  Map<String, dynamic> toJson() => _$CollectArticleInfoToJson(this);
}

@JsonSerializable()
class UserInfo {
  final bool? admin;
  final List<dynamic>? chapterTops;
  final int? coinCount;
  final List<int>? collectIds;
  final String? email;
  final String? icon;
  final int? id;
  final String? nickname;
  final String? password;
  final String? publicName;
  final String? token;
  final int? type;
  final String? username;

  const UserInfo({
    this.admin,
    this.chapterTops,
    this.coinCount,
    this.collectIds,
    this.email,
    this.icon,
    this.id,
    this.nickname,
    this.password,
    this.publicName,
    this.token,
    this.type,
    this.username,
  });

  factory UserInfo.fromJson(Map<String, dynamic> json) =>
      _$UserInfoFromJson(json);

  Map<String, dynamic> toJson() => _$UserInfoToJson(this);
}
